<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>send data and receive JSON</title>
<script src="../js/jquery-1.3.2.js"></script>
<script>
function sendJsonToAction() {

   var dataToSend = $("#username").val() + "|" + $("#password").val();
   	
   $.getJSON("/struts2Fill/storeJSONData.action", { data : "  data sent is **" + dataToSend + "**"} , function(json){
	   alert("JSON Data from JSONStoreCredentials.java: \n  " 
			   + json);


	   jQuery.each(json, function(index, value) {
		   alert(index +  " : " + value);
	   });

	   
   });
}

</script>

</head>
<body>
    Username: <input id="username" type="text" /> <br>
    Password: <input id="password" type="password" /> <br>
    <input type="button" value="sendJSON" onclick="sendJsonToAction();"/> <p/>
</body>
</html>
